<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--
@html_name: 18class
@description: The past cannot be redeemed, the future can be changed.
@author: Jason Black
@create: 2023/6/26 09:37:31
-->
<script>
  class Student{
    // 构造器名称固定   constructor
    constructor(name,age,sex){
      this.name = name
      this.age = age
      this.sex = sex
    }

    // 方法创建
    method01(){
      console.log("Student method...")
    }
  }
  const STUDENT = new Student("Jason",21,"male")
  console.log(STUDENT)
  STUDENT.method01()

  // 静态属性和方法  使用 static 修饰
  class Teacher {
    static name = "Jason"
    static method01(){
      console.log(`my name is ${this.name}`)
    }
  }
  const teacher = new Teacher()
  // 静态成员只能有类来访问，实力对象无法访问
  // console.log(teacher.name)
  // console.log(teacher.method())
  console.log(Teacher.name)
  Teacher.method01()
</script>
</body>
</html>